package cn.tedu.sp04.feign声明式客户端接口;

import cn.tedu.sp01.pojo.Item;
import cn.tedu.web.util工具类.JsonResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

/*声明式接口的3项配置:
1.调用哪个服务
2.调用服务的哪个路径
3.向这个路径提交什么参数
 */
@FeignClient(name = "item-service")
public interface ItemClient调用商品信息feign {
    //远程调用商品，获取商品列表
    @GetMapping("/{orderId}")
    JsonResult<List<Item>> getItems(@PathVariable("orderId") String orderId);

    //远程调用商品，减少商品库存
    @PostMapping("/decreaseNumber")
    JsonResult<?> decreaseNumber(@RequestBody List<Item> items);

}
